<?php
/**
 * Introduction: 验证登录
 * @author: 杨陈鹏
 * @date: 2016/4/18 16:04
 * @email: yangchenpeng@cdlinglu.com
 */

namespace Common\Controller\App;


use Think\Controller;

class SignController extends Controller
{

    static public $uid,$member_info;

    public function __construct()
    {

        parent::__construct();

        $this->checkLogin();

    }
    /**
     * Introduction: 检测APP端token
     * @author: 杨陈鹏
     * @email: yangchenpeng@cdlinglu.com
     */
    public function checkLogin()
    {

        $token = I('param.token');

        if(!$token && count($token) != 32)
            $this->ajaxReturn(['code' => 500, 'msg' => '请登录!']);

        $member_logic = D('Member','Logic');

        $member_info = $member_logic::$model->where(['uuid' => $token])->find();

        if(!intval($member_info['uid']))
            $this->ajaxReturn(['code' => 500, 'msg' => '用户不存在!']);

        self::$uid = $member_info['uid'];
        self::$member_info  =   $member_info;

    }


}